#include "configdetail.h"
#include "ui_configdetail.h"

ConfigDetail::ConfigDetail(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ConfigDetail)
{
    ui->setupUi(this);
    bdf = BllDataFlow::getInstance();

    //Signals and Slots
    connect(bdf, &BllDataFlow::changeConfigPageIndexSignal, this, &ConfigDetail::changeConfigPageIndexSlot);
    connect(bdf, &BllDataFlow::setWidgetVisibleSignal,this,&ConfigDetail::setWidgetVisibleSlot);
    connect(bdf, &BllDataFlow::retranslateUiSignal, this, &ConfigDetail::retranslateUiSlot);

    initWidget();
}

ConfigDetail::~ConfigDetail()
{
    delete ui;
}

void ConfigDetail::changeConfigPageIndexSlot(int index)
{
    if (index != -1)
    {
        ui->stackedWidget->setCurrentIndex(index);
        ui->stackedWidget->setVisible(true);
    }
    else
    {
        ui->stackedWidget->setVisible(false);
    }
}

void ConfigDetail::setWidgetVisibleSlot(int permission)
{
    Q_UNUSED(permission)
}

void ConfigDetail::retranslateUiSlot()
{
    ui->retranslateUi(this);
}

void ConfigDetail::initWidget()
{
    //设置强焦点策略,这样输入法面板隐藏以后单击界面不会弹出
//    this->setFocusPolicy(Qt::StrongFocus);
    //默认显示系统设置-密码设置页面
    ui->stackedWidget->setCurrentIndex(3);
}
